package com.loong.seller.controller.forehead;

import com.loong.common.domain.BaseQuery;
import com.loong.common.mvc.BaseForeheadController;
import com.loong.common.param.BaseIdParam;
import com.loong.common.rest.Result;
import com.loong.common.validator.group.CommonValidate;
import com.loong.seller.common.forehead.param.ShopContactQueryForeheadParam;
import com.loong.seller.handler.ShopContactHandler;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Description:
 * @Author: hzp
 * @Date: 2020-10-29 10:05
 */
@RestController
@RequestMapping("/forehead/seller/shopContact")
public class ShopContactForeheadController extends BaseForeheadController {

    @Resource
    private ShopContactHandler shopContactHandler;

    /**
     * 分页查询 c端使用
     * @param param 查询条件
     * @return
     */
    @PostMapping("pageQuery")
    public Result pageQuery(@RequestBody ShopContactQueryForeheadParam param){
        return  handlerExecutor.execute(()->shopContactHandler.pageQuery(param));
    }

    /**
     * 根据店铺id查找联系方式 c端使用
     * @param param 店铺id
     * @return
     */
    @PostMapping("findContactByShopId")
    public Result findContactByShopId(@RequestBody @Validated(value = {CommonValidate.class}) BaseIdParam param){
        return handlerExecutor.execute(()->shopContactHandler.FindContactByShopIdToForehead(param.getId()));
    }
}
